Page({
  data: {
    isLogin: true,
    userInfo: {
      nickname: '',
      points: 115,
      coupons: 0,
      balance: 0
    },
    patientCount: 0
  },

  onLoad: function() {
    // 获取用户信息
    this.getUserInfo();
  },

  getUserInfo: function() {
    // TODO: 从服务器获取用户信息
  },

  toUserInfo() {
    if (!this.data.isLogin) {
      this.login();
      return;
    }
    wx.navigateTo({
      url: '/page/userinfo/index'
    });
  },

  // 导航到添加就诊人页面
  navigateToAddPatient: function() {
    wx.navigateTo({
      url: '/pages/addPatient/addPatient'
    });
  },

  // 查看全部订单
  viewAllOrders: function() {
    wx.navigateTo({
      url: '/pages/orderList/orderList'
    });
  },

  // 导航到订单列表（根据类型）
  navigateToOrder: function(e) {
    const type = e.currentTarget.dataset.type;
    console.log("type: ", type);
    wx.navigateTo({
      url: `/page/orderlist/index?param1=${type}`
    });
  },

  // 导航到积分页面
  navigateToPoints: function() {
    wx.navigateTo({
      url: '/pages/points/points'
    });
  },

  // 导航到积分商城
  navigateToPointsMall: function() {
    wx.switchTab({
      url: '/page/points/index'
    });
  },

  // 导航到活动页面
  navigateToActivities: function() {
    wx.navigateTo({
      url: '/pages/activities/activities'
    });
  },

  // 导航到预约页面
  navigateToAppointment: function() {
    wx.navigateTo({
      url: '/pages/appointment/appointment'
    });
  },

  // 导航到客服页面
  navigateToCustomerService: function() {
    wx.navigateTo({
      url: '/page/service/index'
    });
  },

  // 导航到地址管理
  navigateToAddress: function() {
    wx.navigateTo({
      url: '/page/address/index'
    });
  },

  // 导航到报告页面
  navigateToReports: function() {
    wx.navigateTo({
      url: '/page/report/index'
    });
  }
}); 